package com.jihu.design.behavioral.mediator;

/**
 * 塔台:中介者
 * @author jihu
 * @date 2021/9/29
 */
public class ControlTower {


    private boolean canDo = Boolean.TRUE;

    //接受请求
    public void acceptRequest(Captain captain,String action){
        if("fly".equals(action) || "land".equals(action)){
            //
            if(canDo){
                System.out.println("允许......");
                canDo = Boolean.FALSE;
            }else {
                System.out.println("不允许......");
            }
        }

        if("success".equals(action)){
            canDo = Boolean.TRUE;
        }



    }
}
